<template>
  <el-menu  class="el-menu-demo" align="left"
    background-color="#545c64"
            text-color="#fff"
            active-text-color="#409eff"
            router
            :unique-opened="true"
  >
    <el-submenu v-for="(menu,index) in menuList" :key="index" :index="menu.name">
      <template slot="title">
        <span>{{menu.name}}</span>
      </template>
      <el-menu-item v-for="(m,index) in menu.childMenuList" :key="index" :index="m.url">{{m.name}}</el-menu-item>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  data(){
    return {
      menuList:[]
    }
  },
  created(){
    this.axios.get("/user/api/resource/showUserMenu").then((resp)=>{
      if(resp.data.code==1){
        this.menuList=resp.data.data;
      }else{
        this.$message.error("菜单获取失败,请联系管理员");
      }
    })
  }
}
</script>

<style scoped>

</style>
